﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using DXApplicationTangche.UC.订单一览新.辅料.service;
using DevExpress.XtraGrid.Demos.util;
using DXApplicationTangche.service;
using DXApplicationTangche.DTO;
using DXApplicationTangche.UC.下单MTO.Service;

namespace DXApplicationTangche.UC.订单一览新.辅料.辅料重构
{
    public partial class Form辅料SKU维护 : DevExpress.XtraEditors.XtraForm
    {
        private DTO辅料一览 dTO辅料一览 = new DTO辅料一览();
        private String subMaterialTypeId;
        private String subMaterialType;
        private String subMaterialCode;
        private String subMaterialName;
        private String subMaterialSupplier;

        public Form辅料SKU维护(String subMaterialTypeId, String subMaterialType,String subMaterialCode, String subMaterialName,String subMaterialSupplier)
        {
            InitializeComponent();
            this.subMaterialTypeId = subMaterialTypeId;
            this.subMaterialType = subMaterialType;
            this.subMaterialCode = subMaterialCode;
            this.subMaterialName = subMaterialName;
            this.subMaterialSupplier = subMaterialSupplier;
            this.显示();
        }
        private void 显示()
        {
            this.textBox供应商.Text = this.subMaterialSupplier;
            this.textBox辅料名称.Text = this.subMaterialName;
            this.textBox辅料编码.Text = this.subMaterialCode;
            this.textBox辅料类别.Text = this.subMaterialType;
        }
        private void simpleButton确认_Click(object sender, EventArgs e)
        {
            //PlainMessageResult result =  
            //    辅料Service.金蝶辅料SKU保存(
            //        "VEN00004", 
            //        this.subMaterialCode, 
            //        this.subMaterialName, 
            //        this.subMaterialType,
            //        this.textBox规格.Text.Trim().ToString()
            //        );
            PlainMessageResult result = 
                辅料Service.saveSubMaterialSku(
                    this.subMaterialCode,
                    this.textBox规格.Text.Trim().ToString(),
                    "",
                    "");
            if (ConstPlainMessageResult.OK.Equals(result.errorCode))
            {
                MessageBox.Show("操作完成");
            }
            else
            {
                MessageBox.Show(result.errorMessage);
            }
            this.Close();
        }
    }
}